package com.dony.shop.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ShopeeCountryEnum {
 /*   TW("tw","https://xiapi.xiapibuy.com"),
    MY("my","https://my.xiapibuy.com"),
    SG("sg","https://sg.xiapibuy.com"),
    ID("id","https://id.xiapibuy.com"),//印尼
    TH("th","https://th.xiapibuy.com"),
    VN("vn","https://vn.xiapibuy.com"),//越南
    PH("ph","https://ph.xiapibuy.com"),
    BR("br","https://br.xiapibuy.com");*/

    TW("tw","TW","tw1","台湾","https://xiapi.xiapibuy.com"),
    VN("vn","VN","vn","越南","https://vn.xiapibuy.com"),
    SG("sg","SG","sg","新加坡","https://sg.xiapibuy.com"),
    ID("id","ID","id","印尼","https://id.xiapibuy.com"),
    BR("br","BR","br","巴西","https://br.xiapibuy.com"),
    MX("mx","MX","mx","墨西哥","https://mx.xiapibuy.com"),
    CO("co","CO","CO","哥伦比亚","https://co.xiapibuy.com/"),
    CL("cl","CL","CL","智利","https://cl.xiapibuy.com"),
//    PL("pl","PL","PL","波兰","https://xiapi.xiapibuy.com"),
//    ES("es","ES","ES","西班牙","https://xiapi.xiapibuy.com"),
//    FR("fr","FR","FR","法国","https://xiapi.xiapibuy.com"),
    PH("ph","PH","ph","菲律宾","https://ph.xiapibuy.com"),
    TH("th","TH","th","泰国","https://th.xiapibuy.com"),
    MY("my","MY","my","马来","https://my.xiapibuy.com");

    private String country;
    private String capital;
    private String rpc;
    private String name;
    private String url;

    // 获取站点链接
    public static String getUrlByName(String name) {
        ShopeeCountryEnum[] values = ShopeeCountryEnum.values();
        for (ShopeeCountryEnum value : values) {
            if (value.name.equalsIgnoreCase(name)) {
                return value.url;
            }
        }
        return null;
    }

    // 获取站点链接
    public static String getUrlByCapital(String capital) {
        ShopeeCountryEnum[] values = ShopeeCountryEnum.values();
        for (ShopeeCountryEnum value : values) {
            if (value.capital.equalsIgnoreCase(capital)) {
                return value.url;
            }
        }
        return null;
    }



    public static String getNameByCapital(String capital) {
        ShopeeCountryEnum[] values = ShopeeCountryEnum.values();
        for (ShopeeCountryEnum value : values) {
            if (value.capital.equalsIgnoreCase(capital)) {
                return value.name;
            }
        }
        return null;
    }

    // 需要查询的价格配置
    public static String getRpcByName(String capital) {
        ShopeeCountryEnum[] values = ShopeeCountryEnum.values();
        for (ShopeeCountryEnum value : values) {
            if (value.capital.equalsIgnoreCase(capital)) {
                return value.rpc;
            }
        }
        return null;
    }


}
